﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CodeGenerator.BaseUI;
using CodeGenerator.Core;
using ICSharpCode.TextEditor.Document;
using CodeGenerator.Common;

namespace CodeGenerator.UI
{
    public partial class FrmMybatisCode : BaseFormEx
    {
        private Dictionary<string,string> content;
        public FrmMybatisCode(Dictionary<string, string> content)
        {
            InitializeComponent();

            this.content = content;
        }

        private void FrmMybatisCode_Load(object sender, EventArgs e)
        {
            foreach (KeyValuePair<string, string> item in content)
            {
                if (item.Key == "entity")
                {
                    FormatCodeHelper.FormatText(textEditorControl1, FormatCodeHelper.JAVA, item.Value);
                }
                else if (item.Key == "dao")
                {
                    FormatCodeHelper.FormatText(textEditorControl2, FormatCodeHelper.JAVA, item.Value);
                }
                else if (item.Key == "mapper")
                {
                    FormatCodeHelper.FormatText(textEditorControl3, FormatCodeHelper.XML, item.Value);
                }
                else if (item.Key == "iservice")
                {
                    FormatCodeHelper.FormatText(textEditorControl4, FormatCodeHelper.JAVA, item.Value);
                }
                else if (item.Key == "service")
                {
                    FormatCodeHelper.FormatText(textEditorControl5, FormatCodeHelper.JAVA, item.Value);
                }
            }
        }
    }
}
